A <DIV>
element is used on an HTML page to enclose a block of HTML elements and apply CSS attributes to them. A <DIV>
is a block element. Like a <P>
paragraph, it occupies a rectangular area of the display, and can include CSS layout attributes. These attributes can be inserted directly into the markup for the <DIV>
element, or can be referenced from a style sheet via a <CLASS>
or <ID>
attribute.
A <SPAN>
is an inline element typically used to alter the style of a portion of a paragraph or <DIV>
. For example, suppose you apply a CSS style attributes to a <DIV>
to format all the text it contains in a certain size and color. Within this <DIV>
, you can then enclose certain words within <SPAN>
tags and apply further formatting, for example to give them special emphasis. A <SPAN>
, unlike a <DIV>
, flows with the text around it.
To create a <DIV> in Design View
<DIV>
.
A <DIV>
may enclose text and other HTML elements inserted from the Toolbox or menus.
To create a <SPAN> in Design View
<SPAN>
.
A <SPAN>
may enclose text and other HTML elements inserted from the Toolbox or menus.
To add elements within a <DIV> or <SPAN>
<DIV>
or <SPAN>
element.
Tip To display graphic markers for <DIV>
and <SPAN>
elements in Design View, choose Details from the View menu.